package com.java.imauoj.mapper;

import com.java.imauoj.moudel.Message;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface MessageMapper {

    @Select("select * from message")
    List<Message> getMessageList();

    @Select("select * from message where id=#{id}")
    Message getMessage(@Param("id") int id);

    @Delete("delete message where id = #{id}")
    void deleteMessage(int id);

    @Insert("insert into message(title,in_data,user_id,content) values(#{title},NOW(),#{user_id},#{content})")
    @Options(useGeneratedKeys=true, keyProperty="id", keyColumn="id")
    void addMessage(Message message);

    @Update("update message set id=#{id},title=#{title},content=#{content}")
    void updateMessage(Message message);


}
